/**
 * Copyright (c) 2011 Links Management & Technology S.p.A.
 */

package it.linksmt.jpatest.repository.test;

import it.linksmt.jpatest.domain.Dummy;
import it.linksmt.jpatest.repository.DummyRepository;

import javax.inject.Inject;

import org.springframework.stereotype.Component;

/**
 * Definisce un DB in memoria contenente dati di test.
 * 
 * @author Mario Scalas
 */
@Component("testHelper")
public class RepositoryTestHelper {

	@Inject
	private DummyRepository dummyRepository;

	/**
	 * @return
	 */
	public long getNrOfDummies() {
		return dummyRepository.count();
	}

	/**
	 * @param i
	 * @return
	 */
	public Dummy createMockDummy( long id ) {
		Dummy object = new Dummy();
		object.setId( id );
		object.setName( "Dummy #" + id );
		return object;
	}
}
